/// UI组件库间距令牌
/// 统一管理所有间距值，避免硬编码
class UISpacing {
  // 基础间距值 - 8px基准系统
  static const double xs = 4.0;   // 极小间距
  static const double sm = 8.0;   // 小间距
  static const double md = 16.0;  // 中等间距（基准）
  static const double lg = 24.0;  // 大间距
  static const double xl = 32.0;  // 超大间距
  static const double xxl = 48.0; // 最大间距
  static const double xxxl = 64.0; // 超级大间距

  // 组件特定间距
  static const double buttonPadding = md;
  static const double buttonPaddingSmall = sm;
  static const double buttonPaddingLarge = lg;
  static const double buttonSpacing = md;

  static const double cardPadding = md;
  static const double cardMargin = sm;
  static const double cardContentSpacing = sm;

  static const double dialogPadding = lg;
  static const double dialogMargin = md;
  static const double dialogContentSpacing = md;

  static const double listItemPadding = md;
  static const double listItemSpacing = xs;
  static const double listSectionSpacing = lg;

  // 屏幕和容器间距
  static const double screenPadding = md;
  static const double screenPaddingSmall = sm;
  static const double screenPaddingLarge = lg;

  static const double containerPadding = md;
  static const double containerMargin = sm;

  // 特殊用途间距
  static const double iconTextSpacing = sm;
  static const double formFieldSpacing = md;
  static const double sectionSpacing = lg;
  static const double groupSpacing = xl;

  // 动画和交互间距
  static const double animationOffset = md;
  static const double rippleRadius = 20.0;

  // 骨架屏间距
  static const double skeletonSpacing = sm;
  static const double skeletonItemSpacing = xs;

  // 加载指示器间距
  static const double loadingSpacing = md;
  static const double loadingTextSpacing = sm;

  // 状态组件间距
  static const double stateIconSpacing = sm;
  static const double stateContentSpacing = md;

  // 媒体组件间距
  static const double imageSpacing = sm;
  static const double avatarSpacing = xs;
  static const double mediaControlSpacing = md;

  // 响应式间距
  static double getResponsiveSpacing(double baseSpacing, double screenWidth) {
    if (screenWidth < 600) {
      return baseSpacing * 0.8; // 手机端减小间距
    } else if (screenWidth < 1200) {
      return baseSpacing; // 平板保持原始间距
    } else {
      return baseSpacing * 1.2; // 桌面端增加间距
    }
  }

  // 预定义响应式间距
  static double responsiveXS(double screenWidth) => getResponsiveSpacing(xs, screenWidth);
  static double responsiveSM(double screenWidth) => getResponsiveSpacing(sm, screenWidth);
  static double responsiveMD(double screenWidth) => getResponsiveSpacing(md, screenWidth);
  static double responsiveLG(double screenWidth) => getResponsiveSpacing(lg, screenWidth);
  static double responsiveXL(double screenWidth) => getResponsiveSpacing(xl, screenWidth);
}